package com.example.fenye.service.forum.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.example.fenye.dao.forum.TopicDao;
import com.example.fenye.entity.forum.Topic;
import com.example.fenye.service.forum.TopicService;

@Service
public class TopicServiceImpl implements TopicService {

	@Resource
	TopicDao topicDao;
	
	@Override
	public Long addTopic(Topic topic) {
		Long topicId = topicDao.insertTopic(topic);
		return topicId;
	}

	@Override
	public int getTopicsCount() {
		return topicDao.selectTopicCount();
	}

	@Override
	public List<Topic> getTopicWrapper(int startPos, int pageSize) {
		return topicDao.selectTopicByPage(startPos, pageSize);
	}

	@Override
	public Topic getTopicById(Long topicid) {
		return topicDao.selectTopicById(topicid);
	}

}
